package com.ruihu.admin.constant;

import java.util.Arrays;
import java.util.Optional;

public enum ElectricConfigTypeEnum {

    ELECTRIC_CORE_TYPE_CONFIG(1, "电芯型号配置"),

    CELL_TYPE_CONFIG(2, "电芯类型配置"),

    FACTORY_CONFIG(3,"生产工厂配置");

    private Integer code;

    private String message;

    ElectricConfigTypeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public static ElectricConfigTypeEnum selectByValue(Integer value) {
        Optional<ElectricConfigTypeEnum> first = Arrays.stream(ElectricConfigTypeEnum.values()).filter(e -> e.getCode().equals(value)).findFirst();
        return !first.isPresent() ? null : first.get();
    }
}
